package com.autonavi.yunda.yunji.core.model.mappers;

import com.autonavi.yunda.yunji.core.model.dto.UserProjectRelationDTO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author cizhong.wcs
 * @date 2023/9/4 14:11
 */
@Mapper
public interface UserProjectRelationMapper extends BaseMapper<UserProjectRelationDTO> {
    @SuppressWarnings("all")
    Integer insertBatchSomeColumn(@Param("list") List<UserProjectRelationDTO> userProjectRelationDTOList);

    @Select("select t1.project_id from yunji_user_project_relation t1 and yunji_project t2" +
            " where t1.user_id = #{userId} and t2.bd_id = #{bdId}")
    List<String> listProjectIdsByUserId(@Param("userId") String userId, @Param("bdId") Long bdId);
}
